#ifndef _Config_H
#define _Config_H

#define LED_REV2
#define USE_CRYSTAL

//*************************************************************************/
#ifdef USE_CRYSTAL
#define FCY 4000000LL
#else
#define FCY 8000000LL
#endif
#include "libpic30.h"

#define wait(a) __delay_us(a)


/******* G E N E R I C   D E F I N I T I O N S ************************************************/

#define	HIGH	1
#define	LOW		0
#define	OUTPUT	0
#define	INPUT 	1
#define	SET		1
#define	CLEAR	0


/**PORT D E F I N I T I O N S ****************************************************/

//UART PORT DEFINITIONS
#define UART_RX_DIRECTION   TRISCbits.TRISC14
#define UART_TX_DIRECTION   TRISCbits.TRISC13

//ONE WIRE PORT PIN DEFINITION
///****************************************************
// This Configuration is required to make any PIC MicroController
// I/O pin as Open drain to drive 1-wire.
///****************************************************
#define OW_PIN_DIRECTION 	TRISDbits.TRISD1
#define OW_WRITE_PIN  		LATDbits.LATD1
#define OW_READ_PIN			PORTDbits.RD1


/******* G E N E R I C   D E F I N I T I O N S ************************************************/

#define DELAY_6Us	6
#define DELAY_9Us	9
#define DELAY_10Us	10
#define DELAY_55Us	55
#define DELAY_60Us	60
#define DELAY_64Us	64
#define DELAY_70Us	70
#define DELAY_205Us	205			// DELAY_410Us = DELAY_205Us + DELAY_205Us
#define DELAY_240Us	240			// DELAY_480Us = DELAY_240Us + DELAY_240Us // since the variable is declared as unsigned char

#endif